<%@page import="com.kensure.shike.constant.BusiConstant"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>抽奖报名</title>
	<meta http-equiv="Content-Type" content="textml; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	
	<link href="<%=BusiConstant.context%>/page1/webview/css/index.css" rel="stylesheet" type="text/css" media="all" />
	<script type="text/javascript" src="<%=BusiConstant.context%>/common/js/jquery.min.js"></script>
	<script type="text/javascript" src="<%=BusiConstant.context%>/common/js/jquery.cookie.js"></script>
	<script type="text/javascript" src="<%=BusiConstant.context%>/common/base.js?ver=<%=BusiConstant.version%>"></script>
	<script type="text/javascript" src="<%=BusiConstant.context%>/common/http.js?ver=<%=BusiConstant.version%>"></script>
	<script type="text/javascript" src="<%=BusiConstant.context%>/common/layer/layer.js"></script>
		
	<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.0.js"></script>
	
	<link rel="stylesheet" type="text/css" href="<%=BusiConstant.context%>/common/layui/css/layui.css">
</head>
<style>
 img{max-width:100%}
</style>
<body class="loading" style="background:#fff;">

	<div class="wrapper">	
	   	<div class="whole" id="list" style="text-align:center">

	   	</div>       
	</div>
		
</body>

<script>
var basecontext = '<%=BusiConstant.context%>';
var tokenid = getQueryVariable("token");
addcookie(tokenid);
function getList(){
	var url = getbaseurl("/user/getuser.do");
	var data = {token:tokenid};
	postdo(url, data, function(data){
		var row = data.resultData.row;
		if(!row.realname || !row.phone){
			add();
		}else{
			getQr();
		}
	}, null, null);
}


function getQr(){
	var url = getbaseurl("/cj/isbaoming.do");
	var data = {};
	postdo(url, data, function(data){	
		var row = data.resultData.row;
		showtable(row);
	}, null, null);
}

function showtable(row){
	var html = '<br><div style="font-size:20px;">'+row.title+'</div><br>';
	html += '<div style="text-align:center;"><img alt="" src="'+row.url+'" style="width:90%;"></div><br><br>';
	var name = "点击报名";
	if(row.baoming){
		name = "报名成功";
	}
	html += '<div id="dg" style="text-align:center;"><button id="btn1" onclick="savebaobei('+row.id+')" style="width:200px;"  class="layui-btn layui-btn-normal">'+name+'</button></div>';
	html += '<br><br><br>';
	$("#list").html(html);
}
getList();

function doSearch(){
	getList();
}

function savebaobei(rowid){
	var url = getbaseurl("/cj/baoming.do");
	var data = {id:rowid};
	postdo(url, data, function(data){	
		var row = data.resultData.row;
		$("#btn1").html("报名成功");
	}, null, null);
}


function add(){  
	   var addurl = getbaseurl('/ht/phoneedit?token='+tokenid);	
	   layer.open({
			type: 2,
			title: '基本信息',
			maxmin: false,
			shadeClose: false, //点击遮罩关闭层
			area : ['90%' , '80%'],
			closeBtn:0,
			content: addurl
	   });
}

</script>

</html>
